﻿using System;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using YJKRevitView;

namespace YJKRevitInnerCmd
{
	[Transaction(TransactionMode.Manual)]
	[Regeneration(RegenerationOption.Manual)]
	public class CmdRoom : IExternalCommand
	{
		public Result Execute(ExternalCommandData cmdData, ref string msg, ElementSet elems)
		{
			CmdViewType types = CmdViewType.FloorPlan;
			if (SwitchView.SetUsableView(types, cmdData) != Autodesk.Revit.UI.Result.Succeeded)
			{
				return Autodesk.Revit.UI.Result.Failed;
			}
			RevitCommandId revitCommandId = RevitCommandId.LookupPostableCommandId(Autodesk.Revit.UI.PostableCommand.Room);
			cmdData.Application.PostCommand(revitCommandId);
			return Autodesk.Revit.UI.Result.Succeeded;
		}
	}
}
